<template>
  <div>
      <button @click="fun('A')">keep点我跳转A</button>
      <button @click="fun('B')">keep点我跳转B</button>
      <button @click="fun('D')">keep点我跳转D</button>
       <keep-alive include="A" exclude="B,C">
      <component :is="text"></component>
      </keep-alive>
  </div>
</template>

<script>
import A from "./a.vue"
import B from "./b.vue"
import D from "./d.vue"
export default {
    data(){
        return{
            text:"A"
        }
    },
    methods:{
        fun(data){
            this.text=data
        }
    },
    components:{
        A,B,D
    }
}
</script>

<style>

</style>